const CategoryData = [
  {
    'mallCategoryId': '0001',
    'mallCategoryName': '白酒',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': '0001',
        'mallCategoryId': '00010001',
        'mallSubName': '茅台',
        'comments': null
      },
      {
        'mallSubId': '0002',
        'mallCategoryId': '00010002',
        'mallSubName': '五粮液',
        'comments': null
      },
      {
        'mallSubId': '0003',
        'mallCategoryId': '00010003',
        'mallSubName': '汾酒',
        'comments': null
      },
      {
        'mallSubId': '0004',
        'mallCategoryId': '00010004',
        'mallSubName': '泸州老窖',
        'comments': null
      },
      {
        'mallSubId': '0004',
        'mallCategoryId': '00010004',
        'mallSubName': '泸州老窖1',
        'comments': null
      },
      {
        'mallSubId': '0004',
        'mallCategoryId': '00010004',
        'mallSubName': '泸州老窖2',
        'comments': null
      },
      {
        'mallSubId': '0004',
        'mallCategoryId': '00010004',
        'mallSubName': '泸州老窖3',
        'comments': null
      },
      {
        'mallSubId': '0004',
        'mallCategoryId': '00010004',
        'mallSubName': '泸州老窖4',
        'comments': null
      }
    ]
  },
  {
    'mallCategoryId': '0002',
    'mallCategoryName': '水果',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': '0001',
        'mallCategoryId': '00020001',
        'mallSubName': '哈密瓜',
        'comments': null
      }
    ]
  },
  {
    'mallCategoryId': '1',
    'mallCategoryName': '房源3',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠3',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '2',
    'mallCategoryName': '房源4',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠4',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '3',
    'mallCategoryName': '房源5',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠5',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '4',
    'mallCategoryName': '房源6',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠6',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '5',
    'mallCategoryName': '房源7',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠7',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '6',
    'mallCategoryName': '房源8',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠8',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '7',
    'mallCategoryName': '房源9',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠8',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '8',
    'mallCategoryName': '房源10',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠10',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '9',
    'mallCategoryName': '房源11',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠11',
        'comments': null
      },
    ]
  },
  {
    'mallCategoryId': '10',
    'mallCategoryName': '房源12',
    'comments': null,
    'image': 'https://static.xianglinsen.com/81c1064d71df5815fe24b03d0f335de20.6893959442055564?imageMogr2/format/webp/interlace/1/thumbnail/x346',
    'children': [
      {
        'mallSubId': 'dfads45f64da5g4fd54s5fd5gs46d5f',
        'mallCategoryId': '1',
        'mallSubName': '特惠12',
        'comments': null
      },
    ]
  }
];

class CategoryDataModel {
  String mallCategoryId; // 类别编号
  String mallCategoryName; // 类别名称
  List<dynamic> children; // 子类别
  String comments; // 评价
  String image; // 类别图片

  // 构造函数
  CategoryDataModel({
    this.mallCategoryId,
    this.mallCategoryName,
    this.children,
    this.comments,
    this.image,
  });

  factory CategoryDataModel.fromJson(dynamic json) {
    return CategoryDataModel(
      mallCategoryId: json['mallCategoryId'],
      mallCategoryName: json['mallCategoryName'],
      children: json['children'],
      comments: json['comments'],
      image: json['image'],
    );
  }
}

// 写的假数据和教程上的不一样 这个地方非必须
class CategoryDataListModel {
  List<CategoryDataModel> data;
  CategoryDataListModel(this.data);

  factory CategoryDataListModel.fromJson(List json) {
    return CategoryDataListModel(
      json.map((e) => CategoryDataModel.fromJson(e)).toList()
    );
  }
}

class CategorySubListDataModel {
  List<CategorySubDataModel> data;

  CategorySubListDataModel({this.data});

  CategorySubListDataModel.fromJson(List json) {
    data = List<CategorySubDataModel>();
    json.forEach((v) {
      data.add(CategorySubDataModel.fromJson(v));
    });
  }

  List toJson() {
    List data = List();
    data = this.data.map((v) => v.toJson()).toList();
    return data;
  }
}

class CategorySubDataModel {
  String mallSubId;
  String mallCategoryId;
  String mallSubName;
  Null comments;

  CategorySubDataModel({this.mallSubId, this.mallCategoryId, this.mallSubName, this.comments});

  CategorySubDataModel.fromJson(Map<String, dynamic> json) {
    mallSubId = json['mallSubId'];
    mallCategoryId = json['mallCategoryId'];
    mallSubName = json['mallSubName'];
    comments = json['comments'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['mallSubId'] = this.mallSubId;
    data['mallCategoryId'] = this.mallCategoryId;
    data['mallSubName'] = this.mallSubName;
    data['comments'] = this.comments;
    return data;
  }
}